import {
	BASE_URL
} from './config.js';
export const apiResquest = (params) => { //params 为我们需要调用的接口API的参数 下面会贴具体代码
	params.data = params.data || {}
	return new Promise((resolve, reject) => {
		let url = BASE_URL + params.url; //请求的网络地址和局地的api地址组合
		let requestParams = {
			url: url,
			data: params.data,
			method: params.method || 'get',
			success: (res) => {
				resolve(res);
			},
			fail: (err) => {
				reject(err);
				console.log(err)
				uni.hideLoading()
			},
			complete: () => {
				console.log('请求完成')
				uni.hideLoading()
			}
		}
		return uni.request(requestParams);
	})
}
